/*
 * SystemPropertyTableModel.java
 *
 * Created on 24 September 2004, 09:18
 * Copyright (C) 2004, Velocityme Partnership
 */

package com.velocityme.client.gui.loginhistory;

import com.velocityme.client.gui.VectorTableModel;
import com.velocityme.valueobjects.LoginValue;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;

/**
 *
 * @author  Robert Crida Work
 */
public class LoginHistoryTableModel extends VectorTableModel {
    
    /** Creates a new instance of SystemPropertyTableModel */
    public LoginHistoryTableModel() {
        super(new String[] {"Person", "User", "Login", "Logout", "Status", "Remote Host" });
    }
    
    public void addValues(Collection p_values) {
        m_dataRows.clear();
        Iterator i = p_values.iterator();
        while(i.hasNext()) {
            LoginValue loginValue = (LoginValue)i.next();
            String person = loginValue.getUserValue().getPersonValue().getContactableValue().getNodeValue().getName();
            String user = loginValue.getUserValue().getUserName();
            Date login = loginValue.getLoginTime();
            Date logout = loginValue.getLogoutTime();
            String status = loginValue.getLoginStatusValue().getName();
            String remoteHost = loginValue.getRemoteHost();
            m_dataRows.addElement(new Object[]{ person, user, login, logout, status, remoteHost });
        }
    }
    
}
